import Vue from 'vue'
import App from './App'
import store from './store'
import router from './router'

import "babel-polyfill"
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)

import '../node_modules/font-awesome/css/font-awesome.css'

import apiSerivce from './api/index.js'
Vue.prototype.api = apiSerivce

import commonJs from './utils/common.js'
Vue.prototype.common = commonJs

import '@/assets/css/style.css'

import alertService from './components/alert/alertService.js'
Vue.prototype.alert = alertService

import Pagination from './components/pagination.vue'
Vue.component('Pagination',Pagination)

import PermissionDirective from './components/permission.directive.js';
Vue.directive('permission', PermissionDirective)

import moment from 'moment';
Vue.filter('moment', function (value, formatString) {
  if(value){
    formatString = formatString || 'YYYY-MM-DD HH:mm:ss';
    return moment(value).format(formatString);
  }else {
    return ''
  }
});

Vue.config.productionTip = false

new Vue({
  el: '#app',
  store,
  router,
  components: {App},
  template: '<App/>'
})
